<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Redis;

class RedisMock extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'config:mock';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Init the redis mock data';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        if(!App::isLocal()){
            return $this->error('production is unable to mocked ');
        }

        $mock = $this->getMockData();

        foreach ($mock as $key => $val){
            if(Redis::set($key , $val) != 'OK'){
                return $this->error('redis put not ok! please check the config') ;
            }
        }

    }

    protected function getMockData(){
        return [
            // 3医院
            'cd3hospital#services' =>  json_encode(['system','user','evaluation']),
            "cd3hospital#tenant_id" => "cd3hospital",
            "cd3hospital#department_domain" => json_encode(['jzgzs','lyjgzs']),
            'cd3hospital#tenant_uuid' => "cd3hospital",
            "cd3hospital#admin_display_name" => "成都市第三人民医院",
            "cd3hospital#admin_display_short_name" => "三医院",
            "cd3hospital#logo"=>"logo.png",
            "cd3hospital#logo_mini" => "logo-mini.png",
            "cd3hospital#logo_large" => "logo-large.png",
            'cd3hospital#repository' => '//winged-files.oss-cn-beijing.aliyuncs.com/2a09adc283c847fe8a24ebb7f6a77b8f/',
            "cd3hospital#admin_background" => "bg.jpg",
            'cd3hospital#admin_title' => "诊前评估预约系统",
            'cd3hospital#admin_default_url' => '/admin/evaluation/index/#/patients',
            "cd3hospital#admin_style" => "/img/cd3/style.css",
            "cd3hospital#barcodes" => null,


            // 北京医院
            'bjhospital#services' =>  json_encode(['system','user','medicalcase']),
            "bjhospital#tenant_id" => "bjhospital",
            "bjhospital#department_domain" => json_encode(['jzgzs','lyjgzs']),
            'bjhospital#tenant_uuid' => "bjhospital",
            "bjhospital#admin_display_name" => "北京医院",
            "bjhospital#admin_display_short_name" => "北京医院",
            "bjhospital#logo"=>"logo.png",
            "bjhospital#logo_mini" => "logo-mini.png",
            "bjhospital#logo_large" => "logo-large.png",
            'bjhospital#repository' => '//winged-files.oss-cn-beijing.aliyuncs.com/e0f54cc15d0a432f9ecf0ec06b8b38d0/',
            "bjhospital#admin_background" => "bg.jpg",
            'bjhospital#admin_title' => "血管数据库",
            'bjhospital#admin_default_url' => '/admin/patients/case',
            "bjhospital#admin_style" => "/img/bh/style.css",
            "bjhospital#barcodes" => json_encode([
                '//winged-files.oss-cn-beijing.aliyuncs.com/e0f54cc15d0a432f9ecf0ec06b8b38d0/ios.png/100',
                '//winged-files.oss-cn-beijing.aliyuncs.com/e0f54cc15d0a432f9ecf0ec06b8b38d0/android.png/100'
            ]),


            // 北京医院
            'wingedcare#services' =>  json_encode([ 'system','user','medicalcase','evaluation']),
            "wingedcare#tenant_id" => "wingedcare",
            "wingedcare#department_domain" => null,
            'wingedcare#tenant_uuid' => "wingedcare",
            "wingedcare#admin_display_name" => "e医同创",
            "wingedcare#admin_display_short_name" => "e医同创",
            "wingedcare#logo"=>"logo.png",
            "wingedcare#logo_mini" => "logo-mini.png",
            "wingedcare#logo_large" => "logo-large.png",
            'wingedcare#repository' => '//winged-files.oss-cn-beijing.aliyuncs.com/winged/',
            "wingedcare#admin_background" => "bg.jpg",
            'wingedcare#admin_title' => "创新的SaaS模式诊所智能管理平台",
            'wingedcare#admin_default_url' => '/admin/auth/users',
            "wingedcare#admin_style" => "/img/winged/style.css",
            "wingedcare#barcodes" => null,

            // default
            'default#services' =>  json_encode([ 'system','user','medicalcase','evaluation']),
            "default#tenant_id" => null ,
            "default#department_domain" => null,
            'default#tenant_uuid' => null,
            "default#admin_display_name" => "e医同创",
            "default#admin_display_short_name" => "e医同创",
            "default#logo"=>"logo.png",
            "default#logo_mini" => "logo-mini.png",
            "default#logo_large" => "logo-large.png",
            'default#repository' => '//winged-files.oss-cn-beijing.aliyuncs.com/winged/',
            "default#admin_background" => "bg.jpg",
            'default#admin_title' => "创新的SaaS模式诊所智能管理平台",
            'default#admin_default_url' => '/admin/auth/users',
            "default#admin_style" => "/img/winged/style.css",
            "default#barcodes" => null,



            // 减重工作室微信端
            "jzgzs#tenant_id" => "cd3hospital",
            "jzgzs#department_domain" => json_encode(['jzgzs']),
            "jzgzs#department_uuid" => "jzgzs",
            "jzgzs#staff_group_id" => "2",
            "jzgzs#title"  => "减重工作室",
            "jzgzs#type" => "工作室",
            "jzgzs#department_id" => "1",
            "jzgzs#style" => "blue",
            "jzgzs#statistics_script" => "",
            "jzgzs#wechat_app_id" => "wxeaf4fd2f8cf2ab00",
            "jzgzs#wechat_secrect" => "9ae3732924d3459c538f4476f70f0168",
            "jzgzs#wechat_token" => "weixin",
            "jzgzs#wechat_aes_token" => "",
            "jzgzs#wechat_oauth_callback" => "oauth",
            "jzgzs#wechat_events_subscribe" => '您好，感谢关注刘雁军减重工作室，我们将竭诚为您提供服务。<a href="https://dev-jzgzs.wingedcare.com/">立即进行健康评估</a>',
            "jzgzs#wechat_events_not_register" => '系统未查询到您的注册信息，请注册后再试<a href="https://dev-jzgzs.wingedcare.com">点击进行注册</a>',
            "jzgzs#wechat_templates" => '',
            "jzgzs#wechat_push_domain" => "http://dev-jzgzs.wingedcare.com",
            "jzgzs#wechat_pushurl" => json_encode([
                '114'   => '/inquiry/report/',
            ]),
            "jzgzs#wechat_messages" => json_encode([
                '114' => 'w-J9VkO0i_lw9ojLUPJABggrIvFS1U8R7K2_vx5-evI'
            ]),
            "jzgzs#wechat_menu" => json_encode([
                [
                    "name"       => "我胖吗",
                    "sub_button" => [
                        [
                            "type" => "view",
                            "name" => "体重评估",
                            "url"  => env('CD3_MENU_HOST') . "/create",
                        ],
                        [
                            "type" => "view",
                            "name" => "体型计算器",
                            "url"  => env('CD3_MENU_HOST') . "/caculator",
                        ],
                        [
                            "type" => "view",
                            "name" => "体重记录",
                            "url"  => env('CD3_MENU_HOST') . "/inquiry",
                        ],
                        [
                            "type" => "view",
                            "name" => "个人中心",
                            "url"  => env('CD3_MENU_HOST') . "/home/index",
                        ],
                    ],
                ],
                [
                    "name"       => "我要减重",
                    "sub_button" => [
                        [
                            "type" => "view",
                            "name" => "手术减肥",
                            "url"  => env('CD3_MENU_HOST') . "/static/introduction.html",
                        ],
                        [
                            "type" => "view",
                            "name" => "刘雁军介绍",
                            "url"  => env('CD3_MENU_HOST') . "/static/introduction.html",
                        ],
                        [
                            "type" => "view",
                            "name" => "团队介绍",
                            "url"  => 'http://mp.weixin.qq.com/s/C-kTOyu29ZZGsC2Ez4-17Q',
                        ],
                        [
                            "type" => "view",
                            "name" => "就诊通道",
                            "url"  => env('CD3_MENU_HOST') . '/static/process.html',
                        ], [
                            "type" => "view",
                            "name" => "就诊咨询",
                            "url"  => 'http://articles.wingedcare.com/jzgzs/support.html',
                        ],
                    ],
                ],
                [
                    'name'       => '胖胖社区',
                    "sub_button" => [
                        [
                            "type" => "view",
                            "name" => "胖胖社区",
                            "url"  => env('CD3_MENU_HOST') . '/static/transportation.html',
                        ],
                        [
                            "type" => "view",
                            "name" => "媒体报道",
                            "url"  => 'http://mp.weixin.qq.com/s/_nln7kxFmNWidr9Ohsq_Yg',
                        ],
                        [
                            "type" => "view",
                            "name" => "经典案例",
                            "url"  => 'http://articles.wingedcare.com/jzgzs/cases.html',
                        ],
                        [
                            "type" => "view",
                            "name" => "肥胖教程",
                            "url"  => env('CD3_MENU_HOST') . '/static/transportation.html',
                        ],
                        [
                            "type" => "view",
                            "name" => "减肥的误区",
                            "url"  => env('CD3_MENU_HOST') . '/static/transportation.html',
                        ],
                    ],
                ],
            ]),

        ];
    }



}















